package com.samuel.learning.multithread.interview;

public class ThreadConstruction {

    public static void main(String[] args) {
        if(args.length<1){
            System.out.println("Please enter the stack size.");
            System.exit(1);
        }

        ThreadGroup group = new ThreadGroup("TestGroup");

        Runnable runnable = new Runnable() {

            final int MAX = Integer.MAX_VALUE;
            @Override
            public void run() {
                recurse(0);
            }
            private void recurse(int i){
                System.out.println(i);
                if( i < MAX){
                    recurse(i+1);
                }
            }
        };

        Thread thread = new Thread(group,runnable,"Test",Integer.parseInt(args[0]));
        thread.start();
    }


}
